<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<link rel="stylesheet" href="css/form.css" />
</head>

<body>
	<div id="header-wrap" data-mn=0 data-limit=2>
		<a href="###" data-link="account" data-type="ico" class="left ico-m ico-left"></a>
		<h2>赎回富贵月月</h2>
		<a href="###" data-link="tariff" class="right btn b-small b-red">说明</a>
	</div>
	<div class="" id="" style="padding-bottom: 64px;">
		<div class="tips">
			<div class="t-info">
				申请赎回 <b class="lock"></b>月期，<b class="sh"></b>份<br />
			</div>
			<div class="t-error"></div>
		</div>
		<form>
		<ul class="form-list">
			<li class="ico-m ico-pl ico-mobile" data-type="ico">
				<div class="fl-cont form-input">
					<input type="number" id="id_input" disabled class="preset" placeholder="请输入手机号" />
				</div>
			</li>
			<li class="ico-m ico-pl ico-mail" data-type="ico">
				<div class="fl-cont form-input f-right-btn">
					<input id="yzm" type="number" placeholder="短信验证码" />
					<a href="###" id="yzm_btn" class="btn b-blue">获取验证码</a>
				</div>
			</li>
			<li class="ico-m ico-pl ico-lock-2" data-type="ico">
				<div class="fl-cont form-input f-right-ico">
					<input id="tpw_input" type="password" placeholder="请输入交易密码" />
					<a href="###"  data-type="ico" class="check-pw ico-m ico-eye" ></a>
				</div>
			</li>
		</ul>
		<a href="###">查看赎回详情</a>
		<ul class="label-list c-right">
			<li class="">
				<label>订单号</label>
				<div class="ll-cont"><span class="oid"></span></div>
			</li>
			<li class="">
				<label>锁定期</label>
				<div class="ll-cont"><span class="lock"></span></div>
			</li>
			<li class="">
				<label>赎回份额(份)</label>
				<div class="ll-cont"><span class="sh"></span></div>
			</li>
			<li class="">
				<label>保障收益(元)</label>
				<div class="ll-cont"><span class="">1.00*</span></div>
			</li>
			<li class="">
				<label>损失收益(元)</label>
				<div class="ll-cont"><span class="">36.78*</span></div>
			</li>
			<li class="">
				<label>赎回到账(元)*</label>
				<div class="ll-cont"><span class="sh"></span></div>
			</li>
			<li class="">
				<label>手续费(元)</label>
				<div class="ll-cont"><span class="">5.00*</span></div>
			</li>
			<li class="">
				<label>违约金(元)</label>
				<div class="ll-cont"><span class="">12.00*</span></div>
			</li>
		</ul>
		
		<div class="fixed-btn">
			<a href="###" data-link="redeem-y-2" class="btn b-red"><span id="check">确定赎回</span></a>
		</div>
		</form>
		<div class="feed-info">
			<h2>带有“*”的数据和项</h2>
			这些数据和项目是DEMO版的静态数据<br />
			赎回到账的金额在DEMO版里不考虑违约金和手续费的因素，按赎回份数全额到账，以作演示。<br /><br />
			<h2>如有疑问，请咨询...</h2>
			客服电话：400-105-8851<br />
			微信客服：wuyifugui(公众号)
		</div>
	</div>
	<script>
	$(function(){
		$(".check-pw").hover(
			function(){$(this).siblings("input").attr("type","text")},
			function(){$(this).siblings("input").attr("type","password")}
		)
		var sh_temp = $.cookie("sh_temp");
		$(".sh").text(sh_temp)
		var sh_lock = $.cookie("sh_lock_temp");
		$(".lock").text(sh_lock)
		var sh_oid_temp = $.cookie("sh_oid_temp");
		$(".oid").text(sh_oid_temp)
		var user_id = $.cookie("user_id");
		$("#id_input").val(user_id)
		$("#yzm_btn").on("click",function(){
			yzm()
		})
		$("#check").on("click",function(){
			var yzm = $("#yzm").val();
			var id_input = $("#id_input").val();
			var id_temp = $.cookie("id_temp")
			var yzm_code = $.cookie("yzm")
			var tpw_input = $("#tpw_input").val();
			var tpw = $.cookie("tpw")
			if(yzm !== yzm_code){
				$(".t-error").text("无效短信验证码").fadeIn(100)
				$(".t-info").hide()
				reset_tip()
				return false
			}else if(id_input !== id_temp && id_temp !== undefined){
				$(".t-error").text("无效手机号").fadeIn(100)
				$(".t-info").hide()
				reset_tip()
				return false
			}else if(tpw_input !== tpw){
				$(".t-error").text("交易密码错误").fadeIn(100)
				$(".t-info").hide()
				reset_tip()
				return false
			}else{
				var balance = parseInt($.cookie("balance"));
				var keep = parseInt($.cookie("keep_"+sh_lock))-sh_temp;
				balance += sh_temp;
				$.cookie("balance",balance)
				$.cookie("keep_"+sh_lock,keep)
				var yo = $.cookie("yo")
				var del_order = new RegExp(sh_lock+","+sh_temp+","+sh_oid_temp+"\/?")
				var del_yo = yo.match(del_order)
				var new_yo = yo.replace(del_order,"")
				var yo = $.cookie("yo",new_yo)
				$.cookie("id_temp","",{expires: -1})
				$.cookie("yzm","",{expires: -1})
				$.cookie("sh_temp","",{expires: -1})
				$.cookie("sh_lock_temp","",{expires: -1})
				$.cookie("sh_oid_temp","",{expires: -1})
			}
		})
	})
	</script>	
</body>

</html>
